const fs = require('fs');
const path = require('path')
const system = require('./system')

// 读取 properties 文件的函数
function readPropertiesFile(filePath) {
    const content = fs.readFileSync(filePath, 'utf-8');
    const lines = content.split('\n');
    const properties = {};

    for (const line of lines) {
        // 忽略注释和空行
        if (line.trim() === '' || line.trim().startsWith('#')) {
            continue;
        }

        const [key, value] = line.split('=');
        properties[key.trim()] = value.trim();
    }

    return properties;
}

// 读取配置文件
let filePath = path.join(system.getHomePath(), `config.properties`);
console.log('config filePath=',filePath)
const config = readPropertiesFile(filePath);

console.log('Config:', config);

function get(key){
    return config[key];

}
module.exports = {
    get,
};
